package com.zx.inf.sys.controller;

import com.zx.inf.sys.service.QueryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/query")
public class QueryController {

    @Autowired
    private QueryService queryService;

    @PostMapping("/{infName}")
    public ResponseEntity<List<Map<String, Object>>> query(@PathVariable String infName, @RequestBody Map<String, Object> params) {
        List<Map<String, Object>> result = queryService.executeQuery(infName, params);
        return ResponseEntity.ok(result);
    }
}
